package com.hszl.blog.controller;

import com.hszl.blog.service.CategoryService;
import com.hszl.blog.vo.Result;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: 胡爽
 * @date: 2022/6/1 9:26
 **/
@RestController
@RequestMapping("categorys")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;
    @GetMapping
    public Result listCategory(){

        return categoryService.findAll();
    }
    @GetMapping("detail")
    public Result categoryDetail(){
        return categoryService.findCategoryDetail();
    }

    @GetMapping("detail/{id}")
    public Result findCategoryDetailById(@PathVariable("id") Long id){
        return categoryService.findCategoryDetailById(id);
    }
}
